#include <stdio.h>
#include<stdio.h>
#define M 20
void fun(int bb[], int* n, int y)
{
   
    int i, j;
    for (i = 0;i < *n;i++) {
        if (bb[i] == y) {
            for (j = i;j < *n;j++)
                bb[j] == bb[j + 1];
            *n = *n - 1;
        }

    }

}
int main()
{
    int aa[M], n, y, k;
    scanf_s("%d", &n);
    for (k = 0;k < n;k++)
        scanf_s("%d", &aa[k]);
    scanf_s("%d", &y);

    fun(aa, &n, y);

    for (k = 0;k < n;k++)
        printf("%4d", aa[k]);
    printf("\n");
    return 0;
}